home *** CD-ROM | disk | FTP | other *** search
- public class DisciplineCommand extends Discipline {
- private static final String DISCIPLINE_NAME = "Command";
-
- public boolean cancast(int level, int casterGuid, int targetGuid, float x, float y, float z, boolean bIsPos) {
- if (!((Discipline)this).CheckCastParameters(level, casterGuid, "Command")) {
- return false;
- } else if (!((Discipline)this).CheckCastTarget(targetGuid, "Command")) {
- return false;
- } else if (Codex.IsPlayerGuid(targetGuid)) {
- ((Discipline)this).DisplayNoCast("RPG_DISC_NOPOSSESSION");
- return false;
- } else {
- return true;
- }
- }
-
- public int cast(int level, int casterGuid, int targetGuid) {
- if (!((Discipline)this).CheckCastParameters(level, casterGuid, "Command")) {
- return 0;
- } else if (!((Discipline)this).CheckCastTarget(targetGuid, "Command")) {
- return 0;
- } else {
- ((Discipline)this).SetupWorld("Command");
- if (((Discipline)this).Fizzled(level)) {
- ((Discipline)this).DisplayFizzle("Command", level);
- return 0;
- } else {
- try {
- ((Discipline)this).DisplayCast("Command", level);
- float clanFactor = 1.0F;
- if (super.targetThing.GetActorClanId() == 12) {
- clanFactor = 0.5F;
- }
-
- if (super.targetThing.GetActorClanId() == 9) {
- clanFactor = 0.5F;
- }
-
- if ((super.targetThing.AIGetMindFlags() & 8) == 0 && super.targetThing.GetActorStat(9) >= super.casterThing.GetActorStat(9) && Math.random() * (double)super.targetThing.GetActorStat(5) * (double)clanFactor < Math.random() * (double)super.casterThing.GetActorStat(12)) {
- int effectGuid = super.targetThing.FindActorEffect("ef_disc_command");
- if (effectGuid != 0) {
- super.targetThing.RemoveActorEffect(effectGuid);
- }
-
- super.targetThing.AddActorEffectByLevel("ef_disc_command", Discipline.COMMAND_DURATIONS[level], level, casterGuid, 4);
- } else {
- ((Discipline)this).DisplayResist("Command", level);
- }
-
- return 1;
- } catch (Exception var7) {
- CodexConsole.PrintException(((Throwable)var7).getMessage() + " in " + "Command" + " [cast]");
- return 0;
- } catch (Error var8) {
- CodexConsole.PrintError(((Throwable)var8).getMessage() + " in " + "Command" + " [cast]");
- return 0;
- }
- }
- }
- }
- }
-